<?php
namespace Admin\Controller;
class RateController extends AdminBaseController
{
   public function index()
    {
        if(session('auid')==null){
            $this->display('index/login');
            exit();
        }
        $this->display('rate/index');
        
    }
    
    public function ratelist(){
        if(session('auid')==null){
            $this->display('index/login');
            exit();
        }
        $page=I('page',1);
        $rows=I('rows',50);
        $start=($page-1)*$rows;
        
        $list = M('TradeFee')->order('createdate')->select();
        $count = M('TradeFee')->count();
        $map=array(
            'rows'=>$list,
            'total'=>$count
        );
        $this->ajaxReturn($map,'JSON');
    }  

  public function updaterate(){
       if(session('auid')==null){
            $this->display('index/login');
            exit();
        }
       $rate=I('rate','');
       $id=I('id','');
       if($rate=='' || $id==''){
        $map=array('status'=>2);
          $this->ajaxReturn($map,'JSON');
         exit();
       }
       M('TradeFee')->where('id='.$id)->setField(array('rate'=>$rate));
       $map=array('status'=>1);
       $this->ajaxReturn($map,'JSON');
       exit();
  }  

}